<template>
    <el-aside :width="isShow?'64px':'200px'" >
        <el-menu
          background-color="#373d41"
          text-color="#fff"
          active-text-color="#409eff"
          :unique-opened="true"
          :collapse="isShow"
          :collapse-transition="false"
          :router="true"
        >
          <div class="collapse" @click="collapseClick">|||</div>
          <el-submenu :index="item.id+''" v-for="item in navList" :key="item.id">
            <template slot="title">
              <i :class="icons[item.id]"></i>
              <span>{{item.authName}}</span>
            </template>
            <el-menu-item :index="'/'+item.path" v-for="item in item.children" :key="item.id" class="navtwe">
                <i class="el-icon-menu"></i>
                {{item.authName}}
            </el-menu-item>
          </el-submenu>
        </el-menu>
    </el-aside>
</template>
<script>
import {homeList} from 'network/homelist'
export default {
    name : 'HomeMainAside',
    data(){
        return {
            navList : [],
            icons : {
                "125" : "el-icon-s-custom",
                "103" : "el-icon-s-home",
                "101" : "el-icon-s-goods",
                "102" : "el-icon-s-order",
                "145" : "el-icon-s-data"
            },
            isShow : false
        }
    },
    methods : {
        collapseClick(){
            this.isShow = !this.isShow
        }
    },
    created(){
        homeList().then(res => {
            // console.log(res)
            this.navList = res.data.data
        }).catch(err => {
            this.$Message.error(err.data.meta.msg)
        })
    }
}
</script>
<style lang="less" scoped>
.el-aside{
    height: calc(100% - 60px);
	ul{
		height: 100%;
    }
    .collapse{
        line-height: 24px;
        text-align: center;
        letter-spacing: 0.2em;
        font-size: 12px;
        background-color: #4a5064;
        color: #fff;
        cursor: pointer;
    }
}
.el-menu{
    border-right: none;
}

</style>